package com.lyl.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author lylbell
 * @date 2021-06-22 14:57
 */
@FeignClient(value = "authorization-server")
public interface OAuth2FeignClient {

    /**
     * 获取token
     * @param grantType  授权类型
     * @param username   用户名
     * @param password   登录密码
     * @param loginType  登录类型
     * @param baseToken  Basic Y29pbi1hcGk6Y29pbi1zZWNyZXQ=由第三方客户端信息加密出现的值
     * @return
     */
    @PostMapping("/oauth/token")
    ResponseEntity<JwtToken> getToken(
            @RequestParam("grant_type") String grantType,  //授权类型
            @RequestParam("username") String username,      //用户名
            @RequestParam("password") String password,       //登录密码
            @RequestParam("login_type") String loginType,  //登录类型
            @RequestHeader("Authorization") String baseToken    //Basic Y29pbi1hcGk6Y29pbi1zZWNyZXQ=由第三方客户端信息加密出现的值
    );
}
